#include <bits/stdc++.h>

#include <atcoder/all>
#define LL long long
using namespace std;
using namespace atcoder;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  vector<vector<LL>> diff(2002, vector<LL>(2002, 0)), sum;

  int N;

  cin >> N;
  vector<int> U(N), D(N), L(N), R(N);
  sum = diff;
  for (int i = 0; i < N; i++) {
    cin >> U[i] >> D[i] >> L[i] >> R[i];
    diff[U[i]][L[i]]++;
    diff[U[i]][R[i] + 1]--;
    diff[D[i] + 1][L[i]]--;
    diff[D[i] + 1][R[i] + 1]++;
  }
  int ans = 2000 * 2000;
  for (int i = 1; i <= 2001; i++) {
    for (int j = 1; j <= 2001; j++) {
      diff[i][j] += diff[i - 1][j] + diff[i][j - 1] - diff[i - 1][j - 1];

      if (diff[i][j]) {
        ans--;
      }
      if (diff[i][j] == 1) {
        sum[i][j] = 1;
      }
    }
  }
  for (int i = 1; i <= 2000; i++) {
    for (int j = 1; j <= 2000; j++) {
      sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
    }
  }

  for (int i = 0; i < N; i++) {
    cout << ans + sum[D[i]][R[i]] - sum[U[i] - 1][R[i]] - sum[D[i]][L[i] - 1] + sum[U[i] - 1][L[i] - 1] << "\n";
  }
  return 0;
}
